package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by VegetaKo on 2016/11/3.
 */
@Entity
@Table(name = "salesman_payment",catalog = "")
@DynamicInsert
public class SalesmanPayment  extends BaseEntity {
    private String l2RPayNo;
    private String paymentNo;
    private String salesmanNo;
    private String salesmanName;
    private String payType;
    private String paySta;
    private BigDecimal total;
    private Date auditedDate;

    @Basic
    @Column(name = "l2r_pay_no", nullable = true, length = 32)
    public String getL2RPayNo() {
        return l2RPayNo;
    }

    public void setL2RPayNo(String l2RPayNo) {
        this.l2RPayNo = l2RPayNo;
    }

    @Basic
    @Column(name = "payment_no", nullable = true, length = 32)
    public String getPaymentNo() {
        return paymentNo;
    }

    public void setPaymentNo(String paymentNo) {
        this.paymentNo = paymentNo;
    }

    @Basic
    @Column(name = "salesman_no", nullable = false, length = 64)
    public String getSalesmanNo() {
        return salesmanNo;
    }

    public void setSalesmanNo(String salesmanNo) {
        this.salesmanNo = salesmanNo;
    }

    @Basic
    @Column(name = "salesman_name", nullable = true, length = 32)
    public String getSalesmanName() {
        return salesmanName;
    }

    public void setSalesmanName(String salesmanName) {
        this.salesmanName = salesmanName;
    }

    @Basic
    @Column(name = "pay_type", nullable = true, length = 32)
    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    @Basic
    @Column(name = "pay_sta", nullable = true, length = 64)
    public String getPaySta() {
        return paySta;
    }

    public void setPaySta(String paySta) {
        this.paySta = paySta;
    }

    @Basic
    @Column(name = "total", nullable = true, precision = 2)
    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SalesmanPayment that = (SalesmanPayment) o;

        if (l2RPayNo != null ? !l2RPayNo.equals(that.l2RPayNo) : that.l2RPayNo != null) return false;
        if (paymentNo != null ? !paymentNo.equals(that.paymentNo) : that.paymentNo != null) return false;
        if (salesmanNo != null ? !salesmanNo.equals(that.salesmanNo) : that.salesmanNo != null) return false;
        if (salesmanName != null ? !salesmanName.equals(that.salesmanName) : that.salesmanName != null) return false;
        if (payType != null ? !payType.equals(that.payType) : that.payType != null) return false;
        if (paySta != null ? !paySta.equals(that.paySta) : that.paySta != null) return false;
        if (total != null ? !total.equals(that.total) : that.total != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = l2RPayNo != null ? l2RPayNo.hashCode() : 0;
        result = 31 * result + (paymentNo != null ? paymentNo.hashCode() : 0);
        result = 31 * result + (salesmanNo != null ? salesmanNo.hashCode() : 0);
        result = 31 * result + (salesmanName != null ? salesmanName.hashCode() : 0);
        result = 31 * result + (payType != null ? payType.hashCode() : 0);
        result = 31 * result + (paySta != null ? paySta.hashCode() : 0);
        result = 31 * result + (total != null ? total.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "audited_date", nullable = true)
    public Date getAuditedDate() {
        return auditedDate;
    }

    public void setAuditedDate(Date auditedDate) {
        this.auditedDate = auditedDate;
    }

    public enum SalesmanPayment_{
        l2RPayNo,paymentNo,salesmanNo,salesmanName,payType,payStatotal
    }
}
